#ifndef HANDLER_H
#define HANDLER_H

#include <map>
#include <functional>

typedef std::function<void(void)> AccpetCallback;
typedef std::function<void(void)> ReadCallback;
typedef std::function<void(void)> WriteCallback;

class Handler
{
public:
    Handler(){}
    virtual ~Handler(){}

    void createAccpetCallback(AccpetCallback cb){m_accpetCallback = std::move(cb);}
    void createReadCallback(ReadCallback cb){m_readCallback = std::move(cb);}
    void createWriteCallback(WriteCallback cb){m_writeCallback = std::move(cb);}

    int m_fd; //文件描述符
    AccpetCallback m_accpetCallback;
    ReadCallback m_readCallback;
    WriteCallback m_writeCallback;
};

typedef Handler* HandlePtr;
typedef std::map<int, HandlePtr> HandlerMap;

#endif // HANDLER_H
